//
//  popoverUIPresentationController.swift
//  WEIBO
//
//  Created by 李龙 on 15/6/29.
//  Copyright © 2015年 itheima. All rights reserved.
//

import UIKit

class popoverUIPresentationController: UIPresentationController {
    
    lazy var dumyView: UIView =
    {
        let v = UIView()
        v.backgroundColor = UIColor(white: 0.0, alpha: 0.2)
        return v
        }()
    override init(presentedViewController: UIViewController, presentingViewController: UIViewController)
    {
        super.init(presentedViewController: presentedViewController, presentingViewController: presentingViewController)
        prepareDumyView()
        print(presentedViewController)
        print("qqqqqqq")
    }
    private func prepareDumyView()
    {
        let tap = UITapGestureRecognizer(target: self, action: "close")
        dumyView.addGestureRecognizer(tap)
    }
    func close()
    {
        presentedViewController.dismissViewControllerAnimated(true, completion: nil)
    }
    override func containerViewWillLayoutSubviews() {
        super.containerViewWillLayoutSubviews()
        dumyView.frame = containerView!.bounds
        containerView?.insertSubview(dumyView, atIndex: 0)
        presentedView()?.frame = CGRectMake(100, 56, 200, 240)
    }
}
